package classi;

import interfacce.AccountManager;
import interfacce.ExamsManager;

import java.rmi.RMISecurityManager;

import javax.naming.Context;
import javax.naming.InitialContext;


public class ServerStart {
	
	public static void main(String[] args) {
		
System.setProperty("java.security.policy","./server.policy");
		
		System.setSecurityManager(new RMISecurityManager());
		
		try {
			
			System.out.println("Costruzione AccountManager e ExamManager ...");
			AccountManager am = AccountManagerImpl.getInstance();
			ExamsManager em = ExamsManagerImpl.getInstance();
			System.out.println("Pubblicazione oggetti ...");
			Context naming = new InitialContext();
			naming.rebind("rmi:accountmanager", am);
			//TODO DEVO VEDERE COME PUBBLICARE IL SECONDO OGGETTO
			System.out.println("In attesa di clienti ...");
		
		} catch (Exception e) {
			e.printStackTrace();
		}
	

	}
}